//引入模块
let mysql  = require('mysql')
//创建连接
let cnn = mysql.createConnection({
    host:'127.0.0.1',
    user:'root',
    password:'root',
    database:'baixiu',
})
module.exports={
    login(email,callback){
        //创建sql语句
        let sql = `select * from users where email='${email}'`
        //调用query方法
        cnn.query(sql,(err,result)=>{
            if(err) return callback(err)
            callback(null,result)
            // console.log(result[0].password)
        })
    }
}